package com.tbit.main.service.impl;

import com.tbit.main.constant.DaoParamConstant;
import com.tbit.main.dao.core.MemberLogDao;
import com.tbit.main.pojo.MemberSta;
import com.tbit.main.service.MemberLogService;
import com.tbit.main.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 免押购买记录
 *
 * @author Leon
 * 2019年11月13日 下午9:35:11
 */
@Service("memberLogService")
public class MemberLogServiceImpl implements MemberLogService {
    @Autowired
    private MemberLogDao memberLogDao;

    @Override
    public MemberSta staByTime(Integer accountId, String startTime, String endTime) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put(DaoParamConstant.accountId, accountId);
        params.put(DaoParamConstant.startTime, startTime);
        params.put(DaoParamConstant.endTime, endTime);

        return memberLogDao.staByTime(params);
    }

    @Override
    public MemberSta staByTimeByAccountIds(List<Integer> accountId, String startTime, String endTime) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put(DaoParamConstant.accountId, StringUtil.getListString(accountId));
        params.put(DaoParamConstant.startTime, startTime);
        params.put(DaoParamConstant.endTime, endTime);
        return memberLogDao.staByTimeByAccountIds(params);
    }

    @Override
    public MemberSta staByTimeByAccountId(Integer accountId, String startTime, String endTime) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put(DaoParamConstant.accountId, accountId);
        params.put(DaoParamConstant.startTime, startTime);
        params.put(DaoParamConstant.endTime, endTime);
        return memberLogDao.staByTimeByAccountId(params);
    }

    @Override
    public MemberSta staByAccountIdTime(Integer accountId, String startTime, String endTime) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put(DaoParamConstant.accountId, accountId);
        params.put(DaoParamConstant.startTime, startTime);
        params.put(DaoParamConstant.endTime, endTime);
        return memberLogDao.staByAccountIdTime(params);
    }

    @Override
    public MemberSta staByAccountIdsTime(List<Integer> accountId, String startTime, String endTime) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put(DaoParamConstant.accountId, StringUtil.getListString(accountId));
        params.put(DaoParamConstant.startTime, startTime);
        params.put(DaoParamConstant.endTime, endTime);
        return memberLogDao.staByAccountIdsTime(params);
    }

}
